<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加检查指标</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.3/weui.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <style>
            * {
                padding: 0;
                margin: 0;
            }
            body {
                background-color: #f8f8f8;
            }
        </style>
    </head>
    <body>
    <div class="page">
        <div class="weui-cells__title">检查指标</div>
        <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">检查时间</label></div>
                <div class="weui-cell__bd">
                    <input id="checkTime" class="weui-input" type="date" value=""/>
                </div>
            </div>
            <div class="weui-cell weui-cell_select weui-cell_select-after">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label">就诊医院</label>
                </div>
                <div class="weui-cell__bd">
                    <select id="checkHospital" class="weui-select">
                        <option value="上海市第六人民医院">上海市第六人民医院</option>
                        <option value="北京协和医院">北京协和医院</option>
                        <option value="北京西苑中医院">北京西苑中医院</option>
                        <option value="北京朝阳医院">北京朝阳医院</option>
                    </select>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">今日血压</label></div>
                <div class="weui-cell__bd">
                    <input id="bloodPressure" class="weui-input" type="text" placeholder="请输入今日血压" value=""/>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">今日血脂</label></div>
                <div class="weui-cell__bd">
                    <input id="bloodFat" class="weui-input" type="text" placeholder="请输入今日血脂" value=""/>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">今日血糖</label></div>
                <div class="weui-cell__bd">
                    <input id="bloodSugar" class="weui-input" type="text" placeholder="请输入今日血糖" value=""/>
                </div>
            </div>
            </div>
        <div class="weui-btn-area">
            <a class="weui-btn weui-btn_primary" href="javascript:" onclick="save(this)">确定</a>
            <a class="weui-btn weui-btn_default" href="javascript:" onclick="history.back();">返回</a>
        </div>
    </div>
    
    <div id="dialog-success" style="display: none;">
        <div class="weui-mask"></div>
        <div class="weui-dialog">
            <div class="weui-dialog__hd"><strong class="weui-dialog__title">保存成功</strong></div>
            <div class="weui-dialog__ft">
                <a href="javascript:$('#dialog-success').hide(); history.back();" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
            </div>
        </div>
    </div>
        
    </body>
    <script>
        var now = new Date();
        var day = ("0" + now.getDate()).slice(-2);
        var month = ("0" + (now.getMonth() + 1)).slice(-2);
        var today = now.getFullYear()+"-"+(month)+"-"+(day);
    
        $("#checkTime").val(today);
        function save() {
            var data={};
            data.checkTime = $('#checkTime').val()
            data.checkHospital = $('#checkHospital').val()
            data.bloodPressure = $('#bloodPressure').val()
            data.bloodFat = $('#bloodFat').val()
            data.bloodSugar = $('#bloodSugar').val()
            $.ajax({
                type: "POST",
                url: "http://patient-demo.huimeimt.cn:8080/checkInfo/insertCheckInfo",
                data: JSON.stringify(data),
                dataType: 'json',
                contentType: 'application/json',
                success: function (data) {
                    console.log(data)
                    $("#dialog-success").show();
                },
            });
        }
    </script>
</html>

